package com.bell.atensettings.widgets;

import com.bell.atensettings.R;

import android.app.ActionBar.LayoutParams;
import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class ProgressDialog
{
    private String message;

    public void setMessage(String info)
    {
        message = info;
    }

    public Dialog createLoadingDialog(Context context)
    {
        View view = LayoutInflater.from(context).inflate(R.layout.loading_dialog, null);
        LinearLayout linearlayout = (LinearLayout) view.findViewById(R.id.dialog_view);
        ImageView imageview = (ImageView) view.findViewById(R.id.img);
        TextView textview = (TextView) view.findViewById(R.id.tipTextView);
        Dialog dialog = new Dialog(context, R.style.loading_dialog);

        imageview.startAnimation(AnimationUtils.loadAnimation(context, R.drawable.loading_animation));
        textview.setText(message);
        dialog.setCancelable(false);
        dialog.setContentView(linearlayout, new android.widget.LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
                LayoutParams.FILL_PARENT));

        return dialog;
    }
}
